from socket import *
from threading import Thread
udp_client = socket(AF_INET,SOCK_DGRAM)
udp_client.bind(('',8088))
address = ('192.168.0.107', 8080)

def send():
    while True:
        mess = input('我：')
        udp_client.sendto(mess.encode('utf-8'),address)

def recv():
    while True:
        data = udp_client.recvfrom(1024)
        print('对反：%s' % data[0].decode('gbk'))

if __name__ == '__main__':
    t1 = Thread(target=send)
    t2 = Thread(target=recv)
    t1.start()
    t2.start()
    t1.join()
    t2.join()



